import java.util.Scanner;

public class test4 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt(); // 口罩个数
        int k = in.nextInt();// 最大的可接受舒适度

        int[] nums = new int[n]; //
        for (int i = 0; i < n; i++) {
            // 初始值
            nums[i] = in.nextInt();
        }
        int result = getResult(nums,k);
        System.out.println(result);
    }

    public static int getResult(int[] nums,int k){
        // 每一天都找最舒适的那一个口罩就可以
        int count = 0;
        int n = nums.length;
        int flag = 0;
        while (flag<=k){
            int min = Integer.MAX_VALUE;
            int index = 0;
            for (int i = 0; i < n; i++) {
                if(min>nums[i]){
                    min = nums[i];
                    index = i;
                }
            }
            flag+=min;
            nums[index] = nums[index]*2;
            if(flag<=k)
                count++; //使用了一天
        }

        return count;
    }

}
